package menus;

import gui.Message;
import gui.ExceptionEvent;
import gui.ExceptionListener;
import gui.MainView;

import java.awt.Toolkit;
import java.awt.event.ActionListener;

import javax.swing.Icon;

public class MenuSuperclass {

	protected MainView mv = null;
	public static final int OPERATIONSUCCESS = 0;
	public static final int OPERATIONFAILED = 1;
	public static final int VALIDATIONERROR = 2;

	public MenuSuperclass() {
		super();
	}

	public Message message(String msg, Icon icon){
		return new Message(msg, icon);
	}
	
	public Message message(String title, String msg){
		return new Message(title, msg);
	}
	
	public void exceptionGenerated(ExceptionEvent ex) {
		String message = ex.getMessage();
	
		// annoying beep sound
		Toolkit.getDefaultToolkit().beep();
	
		if (message != null)
		{	
			mv.updateStatusBar(ex.getMessage());
			
		}
		else
		{
			mv.updateStatusBar("An exception occurred!");
		}
	}

}